using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;

namespace Data.Models.Mapping
{
    public class VW_avisosMap : EntityTypeConfiguration<VW_avisos>
    {
        public VW_avisosMap()
        {
            // Primary Key
            this.HasKey(t => new { t.aviso_codigo, t.aviso_data, t.aviso_descricao, t.aviso_hora, t.aviso_usuario, t.set_descricao, t.aviso_setor, t.aviso_unidade });

            // Properties
            this.Property(t => t.aviso_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.data)
                .HasMaxLength(30);

            this.Property(t => t.usu_login)
                .HasMaxLength(100);

            this.Property(t => t.aviso_descricao)
                .IsRequired()
                .HasMaxLength(1024);

            this.Property(t => t.aviso_hora)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.aviso_usuario)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.set_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.aviso_setor)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.aviso_unidade)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("VW_avisos");
            this.Property(t => t.aviso_codigo).HasColumnName("aviso_codigo");
            this.Property(t => t.aviso_data).HasColumnName("aviso_data");
            this.Property(t => t.data).HasColumnName("data");
            this.Property(t => t.usu_login).HasColumnName("usu_login");
            this.Property(t => t.aviso_descricao).HasColumnName("aviso_descricao");
            this.Property(t => t.aviso_hora).HasColumnName("aviso_hora");
            this.Property(t => t.aviso_usuario).HasColumnName("aviso_usuario");
            this.Property(t => t.set_descricao).HasColumnName("set_descricao");
            this.Property(t => t.aviso_setor).HasColumnName("aviso_setor");
            this.Property(t => t.aviso_unidade).HasColumnName("aviso_unidade");
        }
    }
}
